const path = require("path");
module.exports = {
  srcDir: "src/",
  head: {
    title: "泊天",
    link: [
      { rel: "stylesheet", href: "/base.css" },
      { rel: "stylesheet", href: "/script/lib/weui/weui.min.css" },
      { rel: "favicon", href: "favicon.ico" },
    ],
    script: [
      { src: "/base.js", defer: "defer" },
      { src: "/response.js", defer: "defer" },
      { src: "/common.js", defer: "defer" },
      { src: "/xui.js", defer: "defer" },
      { src: "/script/lib/jquery.min.js", defer: "defer" },
      { src: "/script/lib/weui/weui.min.js", defer: "defer" },
    ],
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
    ],
  },
  plugins: [
    "~/plugins/global.js",
    "~/plugins/vue-inject.js",
    "~/plugins/ctx-inject.js",
    "~/plugins/font-awesome",
  ],
  modules: [
    "@nuxtjs/axios",
    [
      "nuxt-fontawesome",
      {
        // See https://github.com/vaso2/nuxt-fontawesome
        // 这里设置了组建的标签为fa
        // 如果不设置，则默认为在font-awesome.js中，生成的：font-awesome-icon
        component: "fa",
        imports: [
          {
            set: "@fortawesome/free-solid-svg-icons",
            icons: ["fas"],
          },
          {
            set: "@fortawesome/free-regular-svg-icons",
            icons: ["far"],
          },
          {
            set: "@fortawesome/free-brands-svg-icons",
            icons: ["fab"],
          },
        ],
      },
    ],
  ],
  axios: {
    proxy: true,
  },
  proxy: {
    "/api/": "http://api.example.com",
    "/api2/": "http://api.another-website.com",
  },
  build: {
    extend(config, { isDev, isClient }) {
      Object.assign(config.resolve.alias, {
        U: path.resolve("src/common/utils"),
      });
    },
  },
};
